﻿#region itdc

/************************************************************************
*Copyright(C) 2015 by qsgy
 *All rights reserved. 
 *FileName:     $safeitemname$
 *Author:       oyh
 *Version:      
 *UnityVersion：
 *Date:   $time$      
 *Description:    
 *History: 
************************************************************************/
#endregion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 触发器触发通信
/// </summary>
/// <typeparam name="T"></typeparam>
[System.Serializable]
public class OnTrigMesSend<T> : MessageTrigger<T> {

    private void OnTriggerEnter(Collider other)
    {
        if(Filter(other))
        TriggerSend();
    }

    /// <summary>
    /// 过滤器。当碰撞物体符合条件时，才会发送信号
    /// </summary>
    /// <param name="co"></param>
    /// <returns></returns>
    protected virtual bool Filter(Collider co)
    {
        return true;
    }
}
